module.exports = function() {
    var angularjs = require('angular');    
    var angularjs = require('angular-sanitize');
    var angularUIRouter = require('angular-ui-router');
    var appServices = require("./home.services");
    var appControllers = require("./home.controllers");
    var appDirectives = require("./home.directives");
    var appFilters = require("./home.filters");

    var app = angular.module('bodyApp', ['ui.router', 'ngSanitize'])
    
    .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
        $stateProvider
        .state('home',{
            url: '/home',
            template: "this is home controler"
        })
        .state('other',{
            url: "/other",
            templateUrl: 'templates/self_script.html',
            controller: 'otherCtl'
        })
        .state('user',{
            url: "/user",
            templateUrl: 'templates/self_script.html',
            controller: 'userCtl'
        });
        $urlRouterProvider.otherwise('/home');
    }])

    .provider('dummyData', appServices.dummyData)

    .factory('ProductService', appServices.productService)
    .factory('UserService', ['$q', 'dummyData', appServices.userService])

    .controller('bodyCtl', ['$scope', 'ProductService', '$http', appControllers.homeCtl])
    .controller('otherCtl', ['$scope', appControllers.otherCtl])
    .controller('userCtl', ['$scope', 'UserService', appControllers.userCtl])

    .directive('ngHeader', appDirectives.ngHeader)

    .filter('displayData', appFilters.displayData);

    this.init = function() {
        angular.bootstrap(document.body, ['bodyApp']);
    };
};
